<template>
	<view class="container">
		<view class="list">
			<view class="item" v-if="detail.status != 1">
				<view class="left">审核状态</view>
				<view class="right">{{detail.statusRemark != null && detail.statusRemark != ""?detail.statusRemark:'审核中'}}</view>
			</view>
			<view class="item">
				<view class="left">项目名称</view>
				<view class="right">{{detail.name}}</view>
			</view>
			<view class="item">
				<view class="left">项目性质</view>
				<view class="right">{{detail.type == 'wt'?"委托":"招标"}}</view>
			</view>
			<view class="item">
				<view class="left">资质要求</view>
				<view class="right">{{detail.requires}}</view>
			</view>
			<view class="item">
				<view class="left">项目地点</view>
				<view class="right">{{detail.place}}</view>
			</view>
			<view class="item">
				<view class="left">项目规模</view>
				<view class="right">{{detail.scale}}</view>
			</view>
			<view class="item">
				<view class="left">项目周期</view>
				<view class="right">{{detail.startDate}}-{{detail.endDate}}</view>
			</view>
			<view class="item">
				<view class="left">开拓佣金</view>
				<view class="right">{{detail.wtf}}</view>
			</view>			
			<view class="item">
				<view class="left">概要说明</view>
				<view class="right">{{detail.remark}}</view>
			</view>
		</view>
		<view class="footer u-flex u-row-around" v-if="detail.status != 1">
			<view class="btn edit" @click="edit">编辑</view>
			<view class="btn del" @click="del">删除</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail:'',
				recordIcon:this.$mAssetsPath.recordIcon
			}
		},
		onLoad(options){
			if(options.data){
				this.detail = JSON.parse(decodeURIComponent(options.data));
			}else{
				uni.showToast({
					title:"项目不存在"
				})
				uni.navigateTo({
					url:'../throughTrain/project'
				})
			}
		},
		methods: {
			edit(){
				this.$mRouter.push({
					route:this.$mRoutesConfig.projectRegistration,
					query:{
						data:encodeURIComponent(JSON.stringify(this.detail))
					}
				})
			},
			async del(){
				let result = await this.$apis.throughTrainDeleteProject({id:this.detail.id});
				if(result.code == 200){
					uni.showToast({
						title:"删除成功",
						icon:"success"
					})
					setTimeout(function(){
						uni.navigateBack({
							delta:1
						})
					},1000);
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	page,.container {background-color: #F5F5F9;}
	.container {
		.header {
			display: flex;
			align-items: center;
			padding: 30upx 30upx 10upx 30upx;
			image{
				width: 60upx;
				height: 60upx;
			}
			.title{
				margin-left: 15upx;
				color: #AB61FF;
				font-size: 32upx;
			}
		}
		.list {
			margin-top:20rpx;
			width: 100%;
			background-color: #fff;

			.item {
				height: 77upx;
				border-bottom: #f4f4f4 solid 1upx;
				display: flex;
				justify-content: space-between;
				padding: 0 30upx;
				align-items: center;
				font-size: 30upx;

				.left {
					color: #0D1D36;
				}

				.right {
					color: #888D99;
				}
			}
		}
	}
	.footer {
		position: fixed;bottom:0;width:100%;height: 100rpx;background-color: #fff;
		.btn {
			width: 270rpx;
			height: 64rpx;
			line-height: 64rpx;
			font-size: 26rpx;
			text-align: center;			
			color: #FFFFFF;
			background: #4B9CFF;
			border-radius: 32rpx;

		}
		.del {
			background: #6ADE7D;	
		}
	}
</style>
